﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Serialization;
using System.Xml;

namespace Media
{
    /// <summary>
    /// Object containing all the informations about a picture media file
    /// </summary>
    [Serializable]
    public class PictureInfo : AMediaInfo
    {
        #region "Construteurs"
        /// <summary>
        /// Used for serialization. Use PictureInfo(String path, Taglib.File f) instead
        /// </summary>
        public PictureInfo()
            : base()
        {
        }

        /// <summary>
        /// Create a new Pictureinfo and get all information about the file ath the path
        /// </summary>
        /// <param name="path">Path of the file</param>
        /// <param name="f">object created by Taglib sharp containing all informations about the file</param>
        public PictureInfo(String path, TagLib.File f)
            : base(path, f)
        {
            if (file != null)
            {
                if (file.Properties != null)
                    Dimension = file.Properties.PhotoWidth.ToString() + "x" + file.Properties.PhotoHeight.ToString();
                if (file.Tag != null)
                    Title = file.Tag.Title;
            }
            if (String.IsNullOrEmpty(Title) == true)
            {
                Title = Path.GetFileNameWithoutExtension(path);
            }
        }
        #endregion
    }
}
